<?php

// +----------------------------------------------------------------------

// | Description: 网络推广部---中台系统和EC外呼系统的接口对接页面

// +----------------------------------------------------------------------

// | Author: zl

// +----------------------------------------------------------------------



namespace app\crm\controller;



use app\admin\controller\ApiCommon;

use app\crm\model\Customer as CustomerModel;

use app\crm\model\CustomerInfoAPI as CustomerInfoAPIModel;//引用EC接口文档

use app\crm\model\CustomerConfig as CustomerConfigModel;

use app\crm\model\CustomerGrade as CustomerGradeModel;

use think\response\Json;

use think\facade\Db;

use app\admin\model\Coupon as CouponModel;

use app\common\traits\ActionRecordTrait;


class CustomerECduijie extends ApiCommon

{
    protected $customerModel;
	
	protected $CustomerInfoAPIModel;

    protected $customerConfigModel;

    /**

     * 用于判断权限

     * @permission 无限制

     * @allow 登录用户可访问

     * @other 其他根据系统设置

     **/

    public function initialize()

    {

        $action = [

            'permission' => ['customerjieshou'],

            'allow' => ['users', 'info']

        ];

        event('CheckAuth',$action);

        $request = $this->request;

        $a = strtolower($request->action());



       $this->customerModel = new CustomerModel();
       
       $this->customerConfigModel = new CustomerConfigModel();
	   
	   $this->customerConfigModel = new CustomerConfigModel();

        if (!in_array($a, $action['permission'])) {

            parent::initialize();

        }

    }
	
	

	public function customerjieshou()
	{
		//获取 EC 系统中 客服修改客户资料的信息
		//$response = '{"crmId":5874197964,"time":"2022-06-08 11:13:33","type":2,"userId":17957856}';
		$response = file_get_contents('php://input'); 
		
		$data = json_decode($response,true);
		$this->param['crmId'] = $data['crmId'];
		$this->param['userId'] = $data['userId'];
		
		
		//var_dump($this->param);
		
		$cusInfo = new CustomerInfoAPIModel();
		$resultT = $cusInfo->addCustomerT($this->param); 
		
		//var_dump($resultT);
	}
		
		
}